home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DESQVIEW.SWG / 0004_Time SLICES for OS-2 & DV.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-26  |  3KB  |  138 lines

  1. {
  2. From: FRED COHEN
  3.       Time Slices...
  4.  
  5. looking for routines for giving up time slices to
  6. various multi-taskers, mainly DV and OS/2.  Please either
  7. post them if they are small enough, or tell me where I can
  8.  
  9. You will need turbo pascal 6.0+ for this to compile.  It is easy to
  10. convert over to regular pascal though.
  11. }
  12.  
  13. Const
  14.  
  15.   MDOS = 0;  { DOS               }
  16.   OS2  = 1;  { OS/2 is installed }
  17.   WIN  = 2;  { Windoze           }
  18.   DV   = 3;  { DesqView          }
  19.  
  20. Var
  21.  
  22.   Ops            : Byte;    { Operating System OS/2/DOS/WIN/DV}
  23.  
  24.  
  25. PROCEDURE giveslice; Assembler; {Gives up remainder of clock cycle
  26.                                  under dos, windows, os/2 }
  27.   asm
  28.     CMP ops,MDos { Compare to DOS }
  29.     JE @MSDOS    { Jump if = }
  30.     CMP ops,Dv   { Compare to Desqview }
  31.     JE @DESQVIEW { Jump if = }
  32.     CMP ops, Win { Compare to Windows }
  33.     JE @WINOS2   { Jump if = }
  34.     CMP ops, OS2 { Compart OS/2 }
  35.     JE @WINOS2   { Jump if = }
  36.     JMP @NONE    { None found, Jump to End }
  37.  
  38.  
  39.  @MSDOS:
  40.     INT 28h   { Interupt 28h }
  41.     JMP @NONE { Jump to the end }
  42.  
  43.  @DESQVIEW:
  44.     MOV ax,1000h { AX = 1000h }
  45.     INT 15h      { Call Interupt 15h }
  46.     JMP @NONE    { Jump to the end }
  47.  
  48.  @WINOS2:
  49.     MOV AX, 1680h { AX = 1680h }
  50.     INT 2Fh       { Call Interupt 2Fh for Win-OS/2 TimeSlice }
  51.  
  52.  @NONE:
  53.  
  54. end; {GiveSlice}
  55.  
  56. {***********}
  57.  
  58. PROCEDURE checkos; Assembler;
  59. { Currently Supports DesqView, Microsoft Windows and IBM's OS/2 }
  60.  
  61. asm
  62.   mov ops, MDos { Default DOS }
  63.   mov ah, 30h   { AH = 30h }
  64.   int 21h  { dos version }
  65.   cmp al, 14h
  66.   jae @IBMOS2 { Jump if >= to 20 }
  67.  
  68.  
  69.   mov ax,2B01h
  70.   mov cx,4445h
  71.   mov dx,5351h
  72.   int 21h { Desqview Installed? }
  73.   cmp al, 255
  74.   jne @DesqView { Jump if AL <> 255 }
  75.  
  76.   mov ax,160Ah
  77.   int 2Fh { Windows Install?}
  78.   cmp ax, 0h
  79.   je @Windows { If = Jump to Windows }
  80.   jmp @Finish { Nothing found, go to the end }
  81.  
  82. @IBMOS2:
  83.   mov Ops, Os2  { Set OS Value }
  84.   jmp @Finish
  85.  
  86. @DesqView:
  87.   mov ops, Dv   { Set OS Value }
  88.   jmp @Finish
  89.  
  90. @Windows:
  91.   mov ops, win  { Set OS Value }
  92.   jmp @Finish
  93.  
  94. @FINISH:
  95. end; { checkos }
  96.  
  97. {***********  MORE  ********}
  98.  
  99. procedure GiveTimeSlice;  ASSEMBLER;
  100. asm     { GiveTimeSlice }
  101.   cmp   MultiTasker, DesqView
  102.   je    @DVwait
  103.   cmp   MultiTasker, Windows
  104.   je    @WinOS2wait
  105.   cmp   MultiTasker, OS2
  106.   je    @WinOS2wait
  107.   cmp   MultiTasker, NetWare
  108.   je    @Netwarewait
  109.   cmp   MultiTasker, DoubleDOS
  110.   je    @DoubleDOSwait
  111.  
  112. @Doswait:
  113.   int   $28
  114.   jmp   @WaitDone
  115.  
  116. @DVwait:
  117.   mov   AX, $1000
  118.   int   $15
  119.   jmp   @WaitDone
  120.  
  121. @DoubleDOSwait:
  122.   mov   AX, $EE01
  123.   int   $21
  124.   jmp   @WaitDone
  125.  
  126. @WinOS2wait:
  127.   mov   AX, $1680
  128.   int   $2F
  129.   jmp   @WaitDone
  130.  
  131. @Netwarewait:
  132.   mov   BX, $000A
  133.   int   $7A
  134.  
  135. @WaitDone:
  136. end;    { TimeSlice }
  137.  
  138.